<template>
    <div class="page-narrow">
        <h1>公共样式</h1>
        <p>基于预先定义的变量，借助于scss的书写便利，我们创建了一些公共样式</p>
        <p>
            为了与其他样式区分开，这些公共样式以
            <i class="code-inline">c</i> 开头，取义
            <i class="code-inline">common</i>
        </p>
        <h2>色彩</h2>
        <pre class="scss">

@each $colorPackageName, $colorPackageValue in $colorPackages {
    .c-theme-color-#{$colorPackageName} {
        color: map-get($colorPackageValue, "themeColor");
    }
    .c-front-color-#{$colorPackageName} {
        color: map-get($colorPackageValue, "frontColor");
    }
    .c-front-color-#{$colorPackageName}-reverse {
        color: map-get($colorPackageValue, "bgColor");
    }
    .c-bg-color-#{$colorPackageName} {
        background-color: map-get($colorPackageValue, "bgColor");
    }
    .c-bg-color-#{$colorPackageName}-reverse {
        background-color: map-get($colorPackageValue, "frontColor");
    }
    .c-color-#{$colorPackageName} {
        color: map-get($colorPackageValue, "frontColor");
        background-color: map-get($colorPackageValue, "bgColor");
    }
    .c-color-#{$colorPackageName}-reverse {
        color: map-get($colorPackageValue, "bgColor");
        background-color: map-get($colorPackageValue, "frontColor");
    }
}
        </pre>

        <h2>尺寸</h2>
        <pre class="scss">

@each $sizePackageName, $sizePackageValue in $sizePackages {
    $size: map-get($sizePackageValue, "size");
    $borderRadius: map-get($sizePackageValue, "borderRadius");
    .c-round-#{$sizePackageName} {
        border-radius: $borderRadius;
        overflow: hidden;
    }
    .c-round-t-#{$sizePackageName} {
        border-top-left-radius: $borderRadius;
        border-top-right-radius: $borderRadius;
        overflow: hidden;
    }
    .c-round-b-#{$sizePackageName} {
        border-bottom-left-radius: $borderRadius;
        border-bottom-right-radius: $borderRadius;
        overflow: hidden;
    }
    .c-round-l-#{$sizePackageName} {
        border-top-left-radius: $borderRadius;
        border-bottom-left-radius: $borderRadius;
        overflow: hidden;
    }
    .c-round-r-#{$sizePackageName} {
        border-top-right-radius: $borderRadius;
        border-bottom-right-radius: $borderRadius;
        overflow: hidden;
    }
    .c-square-#{$sizePackageName} {
        width: $size;
        height: $size;
    }
    .c-width-#{$sizePackageName} {
        width: $size;
    }
    .c-height-#{$sizePackageName} {
        height: $size;
    }
    .c-font-size-#{$sizePackageName} {
        font-size: map-get($sizePackageValue, "fontSize");
        line-height: $size;
    }
    .c-shadow-#{$sizePackageName} {
        box-shadow: 1px 1px $size / 4 $defaultShadowColor;
    }
}

@function getSpaceStr($sizePackageName, $ratioName, $useImportant) {
    @if $ratioName == 0 {
        @if $useImportant {
            @return unquote("0 !important");
        }
        @return 0;
    }
    @return $sizePackageName * $ratioName;
}

@each $spacePropName, $spacePropValue in $spaceProps {
    @each $directionName, $directionValue in $directions {
        @each $sizePackageName, $sizePackageValue in $sizePackages {
            @each $ratioName, $ratioValue in $ratios {
                .c-#{$spacePropName}#{getUnionStr($directionName)}-#{$sizePackageName}#{getUnionStr($ratioName)} {
                    @each $directionItem in $directionValue {
                        #{$spacePropValue}-#{$directionItem}: getSpaceStr(
                            map-get($sizePackageValue, "space"),
                            $ratioValue,
                            true
                        );
                    }
                }
            }
        }
    }
}
        </pre>

        <h2>边框</h2>
        <pre class="scss">
            
@each $directionName, $directionValue in $directions {
    .c-b#{getUnionStr($directionName)} {
        @each $directionItem in $directionValue {
            border-#{$directionItem}: 1px solid $defaultBorderColor;
        }
    }
    .c-b#{getUnionStr($directionName)}-0 {
        @each $directionItem in $directionValue {
            border-#{$directionItem}: 0 !important;
        }
    }
}
        </pre>

        <h2>flex布局</h2>
        <pre class="scss">

.c-layout-h {
    display: flex;
    flex-direction: row;
}

.c-layout-h-inline {
    display: inline-flex;
    flex-direction: row;
}

.c-layout-h-reverse {
    display: flex;
    flex-direction: row-reverse;
}

.c-layout-h-reverse-inline {
    display: inline-flex;
    flex-direction: row-reverse;
}

.c-layout-v {
    display: flex;
    flex-direction: column;
}

.c-layout-v-inline {
    display: inline-flex;
    flex-direction: column;
}

.c-layout-v-reverse {
    display: flex;
    flex-direction: column-reverse;
}

.c-layout-v-reverse-inline {
    display: inline-flex;
    flex-direction: column-reverse;
}

.c-f-p-start {
    justify-content: flex-start;
}

.c-f-p-center {
    justify-content: center;
}

.c-f-p-end {
    justify-content: flex-end;
}

.c-f-p-between {
    justify-content: space-between;
}

.c-f-p-around {
    justify-content: space-around;
}

.c-f-s-start {
    align-items: flex-start;
}

.c-f-s-center {
    align-items: center;
}

.c-f-s-end {
    align-items: flex-end;
}

.c-start-start {
    justify-content: flex-start;
    align-items: flex-start;
}

.c-start-center {
    justify-content: flex-start;
    align-items: center;
}

.c-start-end {
    justify-content: flex-start;
    align-items: flex-end;
}

.c-center-start {
    justify-content: flex-start;
    align-items: center;
}

.c-center-center {
    justify-content: center;
    align-items: center;
}

.c-center-end {
    justify-content: center;
    align-items: flex-end;
}

.c-end-start {
    justify-content: flex-end;
    align-items: flex-start;
}

.c-end-center {
    justify-content: flex-end;
    align-items: center;
}

.c-end-end {
    justify-content: flex-end;
    align-items: flex-end;
}

.c-between-start {
    justify-content: space-between;
    align-items: flex-start;
}

.c-between-center {
    justify-content: space-between;
    align-items: center;
}

.c-between-end {
    justify-content: space-between;
    align-items: flex-end;
}

.c-around-start {
    justify-content: space-around;
    align-items: flex-start;
}

.c-around-center {
    justify-content: space-around;
    align-items: center;
}

.c-around-end {
    justify-content: space-around;
    align-items: flex-end;
}

.c-f-self-start {
    align-self: flex-start;
}

.c-f-self-end {
    align-self: flex-end;
}

.c-f-grow-0 {
    flex-grow: 0;
}

.c-f-grow-1 {
    flex-grow: 1;
}

.c-f-shrink-0 {
    flex-shrink: 0;
}

.c-f-shrink-1 {
    flex-shrink: 1;
}

.c-f-wrap {
    flex-wrap: wrap;
}

.c-f-nowrap {
    flex-wrap: nowrap;
}
        </pre>

        <h2>其他</h2>
        <pre class="scss">
            
.c-position-relative {
    position: relative;
}

.c-position-absolute {
    position: absolute;
}

.c-position-fixed {
    position: fixed;
}

.c-left-0 {
    left: 0;
}

.c-right-0 {
    right: 0;
}

.c-top-0 {
    top: 0;
}

.c-bottom-0 {
    bottom: 0;
}

.c-left-top {
    left: 0;
    top: 0;
}

.c-left-bottom {
    left: 0;
    bottom: 0;
}

.c-hide {
    display: none;
}

.c-cursor-default {
    cursor: default;
}

.c-cursor-pointer {
    cursor: pointer;
}

.c-display-block {
    display: block;
}

.c-display-inline-block {
    display: inline-block;
}

.c-display-inline {
    display: inline;
}

.c-disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.c-align-left {
    text-align: left;
}

.c-align-center {
    text-align: center;
}

.c-align-right {
    text-align: right;
}

.c-s-100 {
    width: 100%;
    height: 100%;
}

.c-w-100 {
    width: 100%;
}

.c-h-100 {
    height: 100%;
}

.c-s-50 {
    width: 50%;
    height: 50%;
}

.c-w-50 {
    width: 50%;
}

.c-h-50 {
    height: 50%;
}

.c-circle {
    border-radius: 50%;
}

.c-bg-color-transparent {
    background-color: transparent;
}

.c-m-0 {
    margin: 0 !important;
}

.c-p-0 {
    padding: 0 !important;
}

.c-scroll-hide {
    scrollbar-width: none; /* Firefox */
}

.c-scroll-hide::-webkit-scrollbar {
    display: none; /* Chrome Safari */
}

        </pre>
    </div>
</template>